<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    // 检查用户是否已登录
    String username = (String) session.getAttribute("username");
    if (username == null) {
        response.sendRedirect("login.jsp");
        return;
    }
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>欢迎页面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .container {
            width: 90%;
            max-width: 500px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 40px;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            text-align: center;
            animation: fadeInUp 0.6s ease-out;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .welcome-icon {
            font-size: 60px;
            color: #667eea;
            margin-bottom: 20px;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }

        h2 {
            color: #333;
            margin-bottom: 15px;
            font-weight: 600;
            font-size: 28px;
        }

        .welcome-message {
            font-size: 20px;
            color: #555;
            margin-bottom: 25px;
            line-height: 1.6;
        }

        .success-message {
            background: #d4edda;
            color: #155724;
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 30px;
            border: 1px solid #c3e6cb;
            animation: slideIn 0.5s ease-out;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .username {
            color: #667eea;
            font-weight: bold;
            font-size: 22px;
        }

        .logout-btn {
            padding: 12px 30px;
            background: linear-gradient(135deg, #dc3545, #c82333);
            color: white;
            text-decoration: none;
            border-radius: 50px;
            font-weight: 600;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
            display: inline-block;
            border: none;
            cursor: pointer;
        }

        .logout-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 7px 20px rgba(220, 53, 69, 0.4);
        }

        .logout-btn:active {
            transform: translateY(-1px);
        }

        .footer-text {
            margin-top: 25px;
            color: #888;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="welcome-icon">🎉</div>
        <h2>欢迎访问</h2>
        <div class="welcome-message">
            欢迎您，<span class="username"><%= username %></span>！
        </div>
        <div class="success-message">
            ✅ 您已成功登录系统
        </div>
        <a href="UserServlet?action=logout" class="logout-btn">🔒 退出登录</a>
        <div class="footer-text">
            祝您使用愉快！
        </div>
    </div>
</body>
</html>
